# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=slony1
pkgver=2.2.10
pkgrel=0
pkgdesc="master to multiple slaves replication system for PostgreSQL"
options="!check" # Requires running instance of postgresql
url="http://slony.info/"
arch="all"
license="PostgreSQL"
makedepends="postgresql-dev"
subpackages="$pkgname-openrc"
source="http://main.slony.info/downloads/${pkgver%.*}/source/slony1-$pkgver.tar.bz2
	slony1.initd
	slony1.confd
	default-config.patch
	"

prepare() {
	default_prepare
	update_config_guess
	update_config_sub
}

build() {
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-pgpkglibdir=/usr/lib/postgresql
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 share/slon.conf-sample "$pkgdir"/etc/slon.conf
	install -Dm755 "$srcdir"/slony1.initd "$pkgdir"/etc/init.d/slony1
	install -Dm644 "$srcdir"/slony1.confd "$pkgdir"/etc/conf.d/slony1
}

sha512sums="1b41addb7a0be0a130c2efcab1b241e3158d10a5a6e203d83f28353e303dd524e224ab9c04a7e37a0f89cd944237b90feeb8910eb35f717926aa3ad28dbe2d0f  slony1-2.2.10.tar.bz2
0281cb197db53cf5c3c6aca3bcc1d7010127fe2a7bbb36d48a9c044311d65e0ffaf0f6b83a0100e1ec0f442bc4614b1d6726b8589f779f36d7369594b956b794  slony1.initd
474fe25e49cd88a705911255d127417dabf9ba675aa67faad336dc419f19ea7416d48e84d26b03b63cec74524383b132439640b715c54fbd22389468342f0e4b  slony1.confd
fa74f013e595faaa801375c41516c23801a4811ac5993a08da1d595550f8fa6fc092c1b7ffd769cd8c9118eb71f3029b0ef1bd24ec502f240512ee97f82ed028  default-config.patch"
